<template>
  <el-card class="box-card">
    <div slot="header" class="clearfix">
      <span>商品图</span>
    </div>
    <div>
      <el-collapse v-model="activeNames">
        <el-collapse-item title="轮播点设置" name="1">
          <el-form label-width="100px" size="medium">
            <el-form-item label='样式'>
              <el-radio-group v-model="data.type">
                <el-radio :label="1">圆角</el-radio>
                <el-radio :label="2">圆形</el-radio>
                <el-radio :label="3">数字</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label='位置'>
              <el-radio-group v-model="data.position">
                <el-radio :label="'flex-start'">居左</el-radio>
                <el-radio :disabled="data.type==3" :label="'center'">居中</el-radio>
                <el-radio :label="'flex-end'">居右</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="选中颜色" v-if="data.type!=3">
              <ColorPicker :color='data' :name='"bg"' ></ColorPicker>
            </el-form-item>
          </el-form>
        </el-collapse-item>
      </el-collapse>
    </div>
  </el-card>
</template>

<script>
  import Upload from '@/components/Upload/SingleImage'
  import draggable from 'vuedraggable'
  import ColorPicker from '@/components/ColorPicker/index'

  export default {
    props: {
      data: {
        type: Object,
        default: {

        }
      }
    },
    data() {
      return {
        activeNames: ['1']
      }
    },
    components: {
      draggable,
      Upload,
      ColorPicker
    },
    methods: {
      getimg(data) {
        let id = data.params.a
        this.data.imglist[id].url = data.tempimg;
        this.data.first_img = this.data.imglist[0];
      },
      addimg() {
        this.data.imglist.push({
          url: ''
        })
      },
      change() {
        this.$emit('change', this.data)
      },
    }
  }
</script>

<style scoped>
  .item {
    position: relative;
    width: 100%;
    display: flex;
    cursor: pointer;
    background: #F4F6F8;
    border-radius: 2px;
    box-sizing: border-box;
    border: 1px solid #E9EDEF;
    margin-bottom: 10px;
    padding: 10px 10px;
  }

  .img_box {
    width: 60px;
    height: 60px;
  }

  .item_select {
    flex: 1;
    margin-left: 10px;
  }

  .select_link {
    background: #fff;
  }

  .select_btn {
    padding: 4px 6px;
    color: #2D8CF0;
    box-sizing: border-box;
    border: 1px solid #fff;
  }

  .select_btn:hover {
    border: 1px solid #2D8CF0;
  }

  .tip {
    display: block;
    font-family: PingFang SC;
    font-style: normal;
    font-weight: normal;
    font-size: 12px;
    line-height: 18px;
    color: #939799;
    /* margin-top: 8px; */
  }
</style>
